package second;


import io.reactivex.Observable;

/**
 * @author
 * @since 2017/7/6 下午7:37
 * Purpose
 */
public class SyncObservable {
    public static Observable customObservableBlocking() {
        return Observable.create(aSubcriber -> {
            for (int i = 0; i < 50; i++) {
                if (!aSubcriber.isDisposed()) {
                    aSubcriber.onNext("value:" + i);
                }
            }
            if (!aSubcriber.isDisposed()) {
                aSubcriber.onComplete();
            }
        });
    }

    public static void main(String[] args) {
        //System.out::println使用了Java8的静态方法引用："::"操作符只引用，不执行
        customObservableBlocking().subscribe(System.out::println);
    }
}
